chrome.extension.sendRequest({cmd: "read_cart"}, function(response){
    if ($(".droppable").length == 0) { 
    	$(document.body).append(response);
    }
    else {
    	$("#shopass").show();
    }
    $("img").draggable({
                revert: 'invalid',
                helper: 'clone',
				start: function(event) {
					//event.preventDefault();
				}
        });
    $(".droppable").droppable({
    	drop: function(ev, ui) {
    		$(".image").html(ui.draggable.clone());
    	}
    });
    
    $("#shopass-save").click(function() {
		product = new Product(location.href, $("#shopass-image").find("img").get(0).src, $("#shopass-price").val());
		chrome.extension.sendRequest({cmd: "save", item: product});
		$(".image img").remove();
		$("#shopass").hide();
	});
});
